var endtime = new Date('2019-09-19 24:00:00').getTime()
//      console.log(endtime)
 var h = 0;
 var m = 0;
 var s = 0;

 function miao() {
     var nowtime = new Date().getTime();
//          console.log(nowtime)
     var cha = (endtime - nowtime) / 1000;
     cha = parseInt(cha)
     h = parseInt(cha / 3600)
//              console.log(h)
     m = (cha / 60) % 60
     m = parseInt(m)
         //     console.log(m)
     s = cha % 60
         //     console.log(s)
     if (h < 10) {
         h = '0' + h
     }
     if (m < 10) {
         m = '0' + m
     }
     if (s < 10) {
         s = '0' + s
     }
     if (cha <= 0) {
         clearInterval(t)
     }
     document.querySelector(".hour").innerHTML = h
     document.getElementById("min").innerHTML = m
     document.getElementById("miao").innerHTML = s
 }
 var t = setInterval(miao, 1000)




















var btn = document.querySelector(".qiang-nr .huan")
var dd = 1
btn.addEventListener('click', function () {
	if (dd <= 2) {
		dd++;
//		var list = document.querySelector(".list")
		document.querySelector("#der").innerHTML=''
		if (dd == 3) {
			dd = 1
		}
		loadXMLDoc()
	}
})

function loadXMLDoc() {
	var xmlhttp;
	if (window.XMLHttpRequest) {
		//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
		xmlhttp = new XMLHttpRequest();
	}
	else {
		// IE6, IE5 浏览器执行代码
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange = function () {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			//					console.log(xmlhttp.responseText)
			var json = JSON.parse(xmlhttp.responseText)
				//					console.log(json.sites)
			for (let i = 0; i < json.sites.length; i++) {
//				console.log(json.sites[i])
				var img = document.createElement("img")
				img.src = json.sites[i].pic
				img.classList.add("tu1")
//				console.log(img)
				var h3 = document.createElement("h4")
				h3.innerHTML = json.sites[i].title
//				console.log(h3)
				var p = document.createElement("p")
				p.innerHTML = json.sites[i].price
//				console.log(p)
				var div = document.createElement("div")
				var a=document.createElement("a")
				div.appendChild(a)
				a.appendChild(img)
				var div2=document.createElement("div")
				div2.classList.add("xiang")
				div2.appendChild(h3)
				div2.appendChild(p)
				var div3=document.createElement("div")
				div3.classList.add("progress")
				var dv=document.createElement("div")
				dv.classList.add("progress-bar")
				div3.appendChild(dv)
				div2.appendChild(div3)
				var div4=document.createElement("div")
				div4.classList.add("desc")
				var span=document.createElement("span")
				span.classList.add("percentage")
				span.innerHTML=json.sites[i].bai
				var span2=document.createElement("span")
				span2.classList.add("letter")
				span2.innerHTML=json.sites[i].fe
				div4.appendChild(span)
				div4.appendChild(span2)
				var div5=document.createElement("div")
				div5.classList.add("extra")
				var span3=document.createElement("span")
				span3.classList.add("yuan")
				span3.innerHTML=json.sites[i].fr
				var span4=document.createElement("span")
				span4.classList.add("cur")
				span4.innerHTML=json.sites[i].ft
				var span5=document.createElement("span")
				span5.classList.add("price")
				span5.innerHTML=json.sites[i].gt
				div5.appendChild(span3)
				div5.appendChild(span4)
				div5.appendChild(span5)
				div2.appendChild(div4)
				div2.appendChild(div5)
				a.appendChild(div2)
//				console.log(div)
				var list = document.querySelector(".qiang-nr2")
				list.appendChild(div)
				
			}
		}
	}
	xmlhttp.open("GET", dd+".json", true);
	xmlhttp.send();
}
loadXMLDoc()